Skip to content

test(falcon): bound the H1 campaign's withheld upload by its deadline - #240

Merged
jimeh merged 2 commits into
mainfrom
fix/falcon-h1-soak-settle
Dec 3, 2026
Merged

jimeh merged 2 commits into
mainfrom
fix/falcon-h1-soak-settle

Conversation

@jimeh

@jimeh jimeh commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

Change

The nightly Lifecycle campaign has failed its Falcon lane on both Rubies since 2026-11-23. Each failure is the same check in the HTTP/1.1 "5 slow peers" scenario:

owned objects after warmup 1 of 5-slow-peers-http1/falcon did not settle within 15s:
  persistent http1 connections changed from [3928] to [5624]

The library is behaving as documented. The campaign's expectation is stale:

  • Since fix(falcon): read unread Connect HTTP/1 input before the response head #192, Falcon reads a declared Connect HTTP/1 remainder under 256 KiB before it writes the response head, as Go's net/http does (maxPostHandlerReadBytes). That is the Falcon Connect H1 retirement policy. Each read wait is bounded by request_body_timeout (60 s by default) and the whole read by the Connect deadline.
  • The scenario's raw client declares a 100 KB upload, sends only the first message, and never sends the rest. The reply therefore arrives only when the 60 s read wait expires. Before fix(falcon): read unread Connect HTTP/1 input before the response head #192, Falcon replied at once.
  • During that wait, the persistent HTTP1Transport client's idle connection to the same server reaches the server's 60 s idle_timeout and is retired. The client then reconnects for its next call. That is correct, but it breaks the campaign's reuse check, which expects the identical idle connection across rounds.

The scenario now sends two withheld uploads:

  • The 100 KB upload carries a 2 s Connect deadline (Soak::TIMER_HEADROOM), which bounds the remainder read. The scenario still checks the documented outcome: a 200 reply, then the close, then the handler ending ok.
  • A second upload declares 1 MB, above the read limit. Falcon leaves that remainder unread and answers at once, which keeps the early-reply coverage the campaign had before fix(falcon): read unread Connect HTTP/1 input before the response head #192.
  • The scenario now also requires each reply's exact Connect body: the echoed message, then an end-stream without an error. Before, it read the body without checking it, so an error end-stream under HTTP 200 would have passed.

Both replies and the close must arrive within the settle bound (15 s). If a change brings back the 60 s wait, the campaign fails at the withheld upload with Async::TimeoutError, not later at an unrelated reuse check. No library, documentation or other scenario changes.

Cause and confirmation

  • The failure reproduces locally on every run on 5d5f5fc (three of three runs).
  • I compared the scenario at 085ab13, just before fix(falcon): read unread Connect HTTP/1 input before the response head #192, with fix(falcon): read unread Connect HTTP/1 input before the response head #192's own commit fc02871, using a probe that logs the persistent client's idle connection identity after each step. At 085ab13 the withheld step takes about 2 ms and the identity never changes. At fc02871 the step takes 60.0 s, the identity changes after it, and the failure reproduces.
  • I then varied one timeout at a time on the scenario's server:
    • With request_body_timeout: 2, the step takes 2.0 s, the identity stays stable, and the scenario passes.
    • With idle_timeout: 120 and the default request_body_timeout, the step still takes 60 s, but the identity stays stable and the scenario passes.

Other scenarios

I compared per-round times between the last green nightly run (45011759023) and the latest failure (47008460705), across both packages and both Rubies. No other scenario gained a wait near request_body_timeout or idle_timeout. The HTTP/2 "5 slow peers" scenario is unaffected because the read-first path is HTTP/1 only.

Two scenarios did get slower in that window, by fractions of a second per round, and still pass:

Scenario Median round before Median round after
1-churn about 0.18 s about 0.56 s
4a-stuck-frame about 0.12 s about 1.03 s

I have not attributed those increases to a commit; #197, which raised the async client cleanup allowance to 1 s, is a plausible cause.

Verification

All on head 6835a06 unless noted.

  • Lifecycle campaign: run 47193383928 is green on all four lanes (async and falcon, Ruby 3.4.12 and 4.0.9, 50 rounds). An earlier dispatch on 2fd4ad6 was cancelled by the workflow's concurrency group when this one started.
  • Repeated scenario runs: CONNECTRPC_SOAK_ROUNDS=50 mise run falcon:soak -- -e "5 slow peers (HTTP/1.1)" passed 2 of 2 times on Ruby 3.4.12 and 2 of 2 on 4.0.9, about 130.5 s each. Each Ruby also passed once more at 2fd4ad6, before the body assertion was added.
  • Whole campaign: mise run falcon:soak passed on both Rubies, all 13 scenarios.
  • Falcon suite: mise run falcon:test passed on both Rubies (663 examples, 0 failures). mise run falcon:check, mise run check and mise run falcon:verify passed.
  • Failure checks (perturbations, reverted afterwards):
    • Removing the deadline header makes the scenario fail at the 100 KB upload's head read with Async::TimeoutError.
    • Setting the first envelope's compressed flag without an encoding makes it fail at the new body assertion, which shows the internal end-stream that the old checks would have accepted.

No library code or spec changed, so no new spec was needed. gems/connectrpc-falcon/spec/http1_read_first_spec.rb already covers the deadline-bounded read and the 256 KiB boundary.


Written on behalf of jimeh by claude-opus-5-5 using Claude Code via T3 Code.

jimeh added 2 commits December 3, 2026 20:03
Since #192 Falcon reads a declared remainder under 256 KiB before it
answers, as net/http does, so scenario 5's withheld 100 KB upload got its
reply only when the default 60 s request_body_timeout expired. During that
wait the server's 60 s idle_timeout retired the persistent client's idle
connection, and every nightly Falcon lane failed its reuse check after
warmup 1.

The withheld upload now carries a 2 s Connect deadline, which bounds the
read, and a second upload declares 1 MB, above the read limit, to keep the
early-reply case the campaign covered before. Both replies are waited for
within the settle bound, so a return to the 60 s wait fails at that step.
The withheld-upload check read the response body without decoding it, so an
error end-stream under HTTP 200 would pass. It now requires the echoed
message followed by an end-stream without an error. The comment on the
deadline now says the two 60 s timers are independent.
@jimeh
jimeh marked this pull request as ready for review December 3, 2026 20:37
@jimeh
jimeh merged commit bee80b7 into main Dec 3, 2026
46 checks passed
@jimeh
jimeh deleted the fix/falcon-h1-soak-settle branch December 3, 2026 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant